<h1>Список продуктов</h1>
	<div style="width:100%">
		<div class="table_body">
			<form id="filter" method="post" action="/backend/products/" onsubmit="return false;">
				<div class="filter_form" style="margin-bottom: 10px;">
					<h3>фильтр</h3>
				    <label for="title" style="width: 170px;">название (может быть долго):</label> 
					<input type="text" id="title" name="filter[title]" value="{$filter_title}" style="width: 300px;">
					<label for="parent" style="margin-left: 20px; width: 190px;">раздел (включая подразделы):</label> 
					{html_options name=filter[category_id] id=parent options=$SectionsOptions selected=$filter_category}
					<br clear="all">
					<label for="price_min">цена от:</label>
					<input type="text" id="price_min" name="filter[price_min]" value="{$filter_price_min}" style="width: 50px;">
					<label for="price_max" style="margin-left: 20px;">до:</label>
					<input type="text" id="price_max" name="filter[price_max]" value="{$filter_price_max}" style="width: 50px; margin-left: -20px;">
				    <div class="operation">
				        <a href="javascript:void(0);" onclick="$('clear').value = 1; window.sendForm.bind($('filter'), null, $('filter').readAttribute('action')).call();" class="delete    ">очистить</a>
				        <a href="javascript:void(0);" onclick="$('clear').value = ''; window.sendForm.bind($('filter'), null, $('filter').readAttribute('action')).call();" class="accept">применить</a>
				        <div style="clear: both;"></div>
				    </div>
				    <input type="hidden" id="clear" name="filter[_clear]" value="">
				</div>
			</form>
			{if $Products->hasPaginate()}
			<div id="products_paging_bottom" class="paging">
				{$Products->showPager()}
				{literal}
					<script>
					    new Pager("products_paging_top");
					</script>
				{/literal}
			</div>
			{/if}<br><br>	
			<table class="text">
				<tr>
					<th><a href="{$fvConfig->get('dir_web_root')}products/?type=id&sort={$sort}"  onclick="go('{$fvConfig->get('dir_web_root')}products/?type=id&sort={$sort}'); return false;" class="link">ID</a></th>
	                <th width="50%"><a href="{$fvConfig->get('dir_web_root')}products/?type=title&sort={$sort}"  onclick="go('{$fvConfig->get('dir_web_root')}products/?type=title&sort={$sort}'); return false;" class="link">Название</a></th>
	                <th><a href="{$fvConfig->get('dir_web_root')}products/?type=main_page&sort={$sort}"  onclick="go('{$fvConfig->get('dir_web_root')}products/?type=main_page&sort={$sort}'); return false;" class="link">На главной</a></th>
	                <th>Раздел</th>
	                <th><a href="{$fvConfig->get('dir_web_root')}products/?type=price&sort={$sort}"  onclick="go('{$fvConfig->get('dir_web_root')}products/?type=price&sort={$sort}'); return false;" class="link">Цена</a></th>
	                <th><a href="{$fvConfig->get('dir_web_root')}products/?type=discount&sort={$sort}"  onclick="go('{$fvConfig->get('dir_web_root')}products/?type=discount&sort={$sort}'); return false;" class="link">Скидка</a></th>
	                <th>Цена со скидкой</th>
	                <th>Пользователь</th>
					<th class="operations">&nbsp;</th>
				</tr>
				{foreach item=Product from=$Products}
				<tr>
					<th>{$Product->getPk()}</th>
	                <td>{$Product->title|stripslashes}</td>
	                <td>{if $Product->main_page}выводится{else}не выводится{/if}</td>
	                <td>
	                	{foreach from=$SectionsManager->getPath($Product->category_id) name=path item=Path}
	                		{if ($Path.id)}
							<A class="link" href="{$fvConfig->get('dir_web_root')}sections/?id={$Path.id}" onclick="go('{$fvConfig->get('dir_web_root')}sections/?id={$Path.id}'); return false;">
				        		{$Path.title|stripslashes}
				        	</a>
							{else}
								{$Path.title|stripslashes}
							{/if}
	                		{if !$smarty.foreach.path.last}>{/if}
	                	{/foreach}
	                </td>
	                <td>{if $Product->price}<b>{$Product->price|number_format:"2"} грн.</b>{else}<b>не указана</b>{/if}</td>
	                <td>{if $Product->discount}<b>{$Product->discount}%</b>{/if}</td>
	                <td>{if $Product->discount}<b>{$Product->price-$Product->price*$Product->discount/100|number_format:"2"} грн.</b>{else}<b>{$Product->price|number_format:"2"}грн.</b>{/if}</td>
	                <td>
	                	{if $Product->user_id}
	                	<A class="link" href="{$fvConfig->get('dir_web_root')}users/edit/?id={$Product->user_id}" onclick="go('{$fvConfig->get('dir_web_root')}users/edit/?id={$Product->user_id}'); return false;">
							{$Product->getDictionary('full_name', 'krshop_users', 'user_id', 'id')} ({$Product->getDictionary('login', 'krshop_users', 'user_id', 'id')})
						</A>
	                	{/if}
	                </td>
				    <td class="mixed">
				        <A href="{$fvConfig->get('dir_web_root')}products/edit/?id={$Product->getPk()}" onclick="go('{$fvConfig->get('dir_web_root')}products/edit/?id={$Product->getPk()}'); return false;">
				        	<img src="{$fvConfig->get('dir_web_root')}img/edit_icon.png" title="редактировать" width="16" height="16">
				        </a>
				        <a href="javascript: void(0);" onclick="if (confirm('Вы действительно желаете удалить продукт?')) go('{$fvConfig->get('dir_web_root')}products/delete/?id={$Product->getPk()}'); return false;">
				        	<img src="{$fvConfig->get('dir_web_root')}img/delete_icon.png" title="удалить" width="16" height="16">
				        </a>
			       </td>
				</tr>
				{/foreach}
			</table>
		</div>
		{if $Products->hasPaginate()}
		<div id="products_paging_bottom" class="paging">
			{$Products->showPager()}
			{literal}
				<script>
				    new Pager("products_paging_bottom");
				</script>
			{/literal}
		</div>
		{/if}
		<div class="operation">
		    <a href="{$fvConfig->get('dir_web_root')}products/edit/" onclick="go('{$fvConfig->get('dir_web_root')}products/edit/'); return false;" class="add">добавить</a>
		    <div style="clear: both;"></div>
		</div>
	</div>